package com.xlh.dto.courseTest.practice;

import com.xlh.dto.course.CourseBasicDTO;
import com.xlh.dto.courseTest.TypeReadingDTO;
import com.xlh.dto.user.UserInfoDTO;
import com.xlh.pojo.course.ChapterBasic;
import com.xlh.pojo.courseTest.Practice;
import lombok.Getter;
import lombok.Setter;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author zhr 2019/4/10
 */
@Getter
@Setter
public class SubmitDTO extends PracticeDTO {
    // 包含题型、题干、用户答案、正确答案、用户得分、实验报告
    private List<TypeReadingDTO> readingList;

    private  String time;

    public SubmitDTO() {
        super();
    }

    public SubmitDTO(Practice practice, List<Practice> practiceList, ChapterBasic chapter, CourseBasicDTO course, UserInfoDTO user, List<TypeReadingDTO> readingList, int score) {
        super(practice, practiceList, chapter, course, user, score);
        this.readingList = readingList;
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.time=simpleDateFormat.format(practice.getCreateTime()==null?new Date():practice.getCreateTime());
    }

    public SubmitDTO(List<TypeReadingDTO> readingList, int score, String checkResult, boolean showAnswer) {
        super(score, checkResult);
        this.readingList = readingList;
        this.setShowAnswer(showAnswer);
    }

    public SubmitDTO(String pdf, String pdfName) {
        super(pdf, pdfName);
    }
}
